Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.5x speed increase by using cmp instead of crc32 #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adiov
Copy link
Contributor

@adiov adiov commented Jan 9, 2025

After seeing how switching from MD5 to CRC32 cut down our rebalance time by a couple of weeks, I rethought the checksum process to identify even more speed gains.

Since the goal is to check that the new file is an exact copy of the original file, byte-level comparison should be a good alternative to calculating a checksum for the whole file. A cmp operation will likely always be faster than any combination of operations used to calculate a checksum. To my delight, this yielded another 1.5x speed improvement.

./zfs-inplace-rebalancing-crc.sh --checksum true --passes 1 ../rebalance-test  43.48s user 39.02s system 116% cpu 1:10.90 total
./zfs-inplace-rebalancing-cmp.sh --checksum true --passes 1 ../rebalance-test  22.27s user 33.38s system 116% cpu 47.771 total

Edit: Apologies for the misleading commit message. I was looking only at the user time rather than the total time. The total time shows 1.5x speed improvement.

@adiov adiov changed the title 2x speed increase by using cmp instead of crc32 1.5x speed increase by using cmp instead of crc32 Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant